package com.jctrip.hotel.management.thread;

import com.jctrip.hotel.common.context.BeanContext;
import com.jctrip.hotel.management.model.param.ExportOrderXlsxParam;
import com.jctrip.hotel.management.service.OrderRecordService;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ExportOrderTaskThread implements Runnable {
    private ExportOrderXlsxParam param;
    private Long id;

    public ExportOrderXlsxParam getParam() {
        return param;
    }

    public void setParam(ExportOrderXlsxParam param) {
        this.param = param;
    }

    public ExportOrderTaskThread() {
    }

    public ExportOrderTaskThread(ExportOrderXlsxParam param, Long id) {
        this.param = param;
        this.id = id;
    }

    @Override
    public void run() {
        try {
            OrderRecordService exportService = BeanContext.getApplicationContext().getBean(OrderRecordService.class);
            exportService.export(param, id);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
}